<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商品类型编辑</title>
<#include "/WEB-INF/content/module-edit.html">
<script type="text/javascript">
var sysStatus = [
    {"id":"0","text":"正常"},
    {"id":"1","text":"禁用"}
];
$(function() {
  	$("#status").combobox({
  		valueField : 'id',
  		textField : 'text',
  		editable:false,
  		data:sysStatus
  	}); 	
 });
 
 function mySave(){
	 <#if object.cstid?exists&&object.cstid!="">
	 var url = "../update";
	 <#else>
	 var url = "create";
	 </#if>		
	$("#form").ajaxSubmit({
		url : url,
		success : function(data) {
			var msg = "操作失败";
			if (data.state) {
				if (data.info)
					msg = data.info;
				else
					msg = "操作成功";
				top.showMsg(msg);
				top.reloadModule(parentModuleId);
				top.closeModule(moduleName, parentModuleName);
			} else {
				if (data.info)
					msg = data.info;
				top.showMsg(msg);
			}
		}
	});
 }
</script>
<style>
.input-width{
	width: 95%;
}
</style>
 
</head>
<body class="easyui-layout">
	<div region="north" id="toolbar" style="background-color: #eee; padding: 5px; overflow: hidden;" border="false">
		<#if object.cstid?exists&&object.cstid!="">
			<@auth code="base:servicetype:update">
				<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-add" style="border: 1px solid #ccc" onclick="javascript:mySave()">保存</a>
			</@auth>
		<#else>
			<@auth code="base:servicetype:create">
				<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-add" style="border: 1px solid #ccc" onclick="javascript:mySave()">保存</a>
			</@auth>
		</#if>
		<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-edit" style="border: 1px solid #ccc" onclick="javascript:cancel()">关闭</a>
	</div>
	<div region="center">
		<div id="p" class="easyui-panel" style="background: #fafafa; padding: 10px" fit="true" toolbar="#toolbar">
			<form id="form" method="post">
			<input id="pid" name="parentid" type="hidden" value="<#if _parent??>${_parent}<#else>${(object.parentid)!}</#if>">
				<table class="form" cellspacing="0" style="width: 100%">
					<tbody style="border: 1px solid #ccc">
						<tr>
							<td class="label">类型ID：</td>
							<td><input id="cstid" name="cstid" value="${(object.cstid)!}" class="easyui-validatebox" required="true" <#if object.cstid?exists&&object.cstid!="">readonly="readonly"</#if>></td>
							<td class="validate">*</td>	
							<td class="label">名称：</td>
							<td><input id="typename" name="typename" value="${(object.typename)!}" class="easyui-validatebox" required="true"></td>
							<td class="validate">*</td>
						</tr>
						<tr>
							<td class="label">状态：</td>
							<td><input id="status" name="status" required="true" value="${object.status!'0'}" /></td>
							<td class="validate"></td>								
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</body>
</html>